package br.com.firula.web;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.ServletActionContext;
import org.springframework.beans.factory.annotation.Autowired;

import br.com.firula.bo.ComentarioBO;
import br.com.firula.to.ComentarioTO;
import br.com.firula.to.BaseTO;
import br.com.firula.web.filter.Filtro;

public class ComentarioAction  extends GenericAction{

	private static final long serialVersionUID = -11105595311416759L;

	HttpServletResponse response;
	HttpServletRequest request;

	private ComentarioBO mgrComentario;

	@Autowired
    public void setComentarioBO(ComentarioBO ComentarioBO) {
        this.mgrComentario = ComentarioBO;
    }

	public String list(){
		this.request = ServletActionContext.getRequest();
		this.response = ServletActionContext.getResponse();

		ComentarioTO comentario = new ComentarioTO();
		Filtro comentarioFiltro = new Filtro();
		comentarioFiltro.setClazz(ComentarioTO.class);
		comentarioFiltro.setExample(comentario);
		request.setAttribute("comentarioList", mgrComentario.getList(comentarioFiltro));
		return "listAdm";
	}

	@Override
	protected BaseTO getNew() {
		return null;
	}

}
